﻿<%@ Page Title="Thông kê thông tin bảo hành" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="WarrantyStatistics.aspx.cs" Inherits="PanasonicWarranty.UI.WarrantyStatistics"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
            ComboBox("ddlSearchAgency");
            DatePicker("txtSearchFromDate,txtSearchToDate");
        });
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table width="100%" cellspacing="0" cellpadding="0" class="">
                    <tbody>
                        <tr>
                            <td>Từ ngày</td>
                            <td><asp:TextBox ID="txtSearchFromDate" runat="server" /></td>
                            <td>Đến ngày</td>
                            <td>
                                <asp:TextBox ID="txtSearchToDate" runat="server" />
                                <span style="color:Red"> (Khoảng tìm kiếm tối đa 3 tháng)</span>
                            </td>
                        </tr>
                        <tr>
                            <td>Đại lý</td>
                            <td><asp:DropDownList ID="ddlSearchAgency" runat="server" /></td>
                            <td>Loại ĐK</td>
                            <td>
                                <asp:DropDownList ID="ddlSearchWarrantyType" runat="server">
                                    <asp:ListItem Value=""></asp:ListItem>
                                    <asp:ListItem Value="ĐKBH">Đăng ký bảo hành</asp:ListItem>
                                    <asp:ListItem Value="GHBH">Gia hạn bảo hành</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" />
                </div>
                <div style="text-align: center; color: Red">
                    <asp:Literal ID="ltrCheckSearch" runat="server"/>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
    <div class="span12">
        <div class="head">
            <div class="isw-grid"></div>
            <h1>Danh sách bảo hành</h1>
            <ul class="buttons">
                <li>
                    <asp:LinkButton CssClass="isw-download" ID="btnExport" runat="server" 
                        ToolTip="Xuất ra file excel" onclick="btnExport_Click"/>
                </li>
            </ul>
            <div class="clear"></div>
        </div>
        <div class="block-fluid table-sorting">
            <div class="dataTables_wrapper" id="tSortable_wrapper">
                <asp:GridView ID="grvData" CssClass="table2 dataTable" runat="server" 
                    AutoGenerateColumns="false" Width="100%" ShowHeaderWhenEmpty="true" ShowFooter="true" onrowdatabound="grvData_RowDataBound">
                    <Columns>
                        <asp:BoundField HeaderText="STT" DataField="STT" ItemStyle-CssClass="STT"/>
                        <asp:BoundField HeaderText="Đại lý" DataField="AgencyName" />
                        <asp:BoundField HeaderText="Số lượng" DataField="WarrantyCount" ItemStyle-CssClass="Phone" />
                    </Columns>
                </asp:GridView>
                <div class="dataTables_info" id="tSortable_info">
                    <asp:Literal ID="ltrInfo" runat="server" />
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
    </div>
    
    <div class="dialog" id="dialog2" title="Gia hạn bảo hành" style="display: none;">
        <asp:Panel ID="pnl_dialog2" runat="server" CssClass="block">
            <asp:HiddenField ID="HiddenField1" Value="" runat="server" />
            <asp:GridView ID="grvWarrantyExtend" runat="server" AutoGenerateColumns="false" Width="100%" CssClass="table dataTable" ViewStateMode="Disabled">
                <Columns>
                    <asp:BoundField HeaderText="Ngày gia hạn" DataField="ExtendDate" DataFormatString="{0: dd/MM/yyyy hh:mm:ss}" />
                    <asp:TemplateField HeaderText='Loại bảo hành'>
                        <ItemTemplate>
                            <%#Eval("Period")%> (<%#Eval("Unit")%>)
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <div style="text-align:center; width:100%; color:Red"><asp:Label ID="lbmsg" runat="server" /></div>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog2').dialog('close'); return false;" />
            </div>
        </asp:Panel>
    </div>
</asp:Content>
